package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.vo.UserIndexVo;
import com.cskaoyan.service.OrderService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author
 * @date 2020/12/9 11:47
 */
@RestController
@RequestMapping("wx/user")
public class WxUserController {
    @Autowired
    OrderService orderService;

    @RequestMapping("index")
    public BaseRespVo index(){
        Subject subject = SecurityUtils.getSubject();
        Integer userId = (Integer) subject.getPrincipal();
        UserIndexVo userIndexVo = orderService.selectUserIndexByUserId(userId);
        HashMap<String, UserIndexVo> map = new HashMap<>();
        map.put("order",userIndexVo);
        return BaseRespVo.ok(map);

    }
}
